#ifndef __INCtaskh
#define __INCtaskh
#include <string>
#include <memory>
#include <thread>
#include <unordered_map>
#include <mutex>
#include <functional>
#include <cstdint>
#include <type.h>
#include <objbase.h>

class Task : public std::enable_shared_from_this<Task>
{
public:
    using TASK_ID = std::thread::id;
    Task(const std::string& name, FUNCPTR func, void* arg);
    ~Task();
    void Run();
    const std::string& getName();
    TASK_ID getThreadId() const;
    bool isRunning() const;
    void execute();

private:
    DISABLE_COPY_CLASS(Task);
    std::string m_name;
    FUNCPTR     m_function;
    std::thread m_threadId;
    TASK_ID     m_taskId;
    void *      m_arg;
    bool        m_isRunning;
};

using TaskPtr = std::shared_ptr<Task>;

#endif